package com.xjust.controller;

import com.xjust.pojo.Result;
import com.xjust.service.OneToOneService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;
import java.util.Map;
@RestController
@Api(tags = "一对一咨询服务") // 用@ApiOperation注解整个类，表示这是一个API的分类
@RequestMapping("/oneToOnes")
public class OneToOneController {
    @Autowired
    OneToOneService onetoOneService;

    // 获取部门信息
    @ApiOperation(value = "获取部门信息", notes = "根据条件获取所有部门的信息")
    @GetMapping("/getDeptment")
    public Result getDeptment(){
        List<Map<String,Object>> list = onetoOneService.getDeptment();
        return Result.success(list);
    }

    // 根据部门ID获取相应部门老师信息
    @ApiOperation(value = "根据部门ID获取老师信息", notes = "通过部门ID获取该部门的所有老师信息")
    @GetMapping("/getTeacherByDeptId")
    public Result getTeacherByDeptId(@RequestParam("deptId") Integer deptId){ // 使用@RequestParam注解以获取URL参数
        List<Map<String,Object>> list = onetoOneService.getTeacherByDeptId(deptId);
        return Result.success(list);
    }
}